<?php
/**
 * Created by : PhpStorm
 * Message: 管理员控制器
 * User: bingdi
 * Time: 2020/2/1815:19
 * motto: 现在的努力是为了小时候吹过的牛逼!
 */

namespace app\common\model;


use think\Model;

class AdminUser extends BaseModel
{
    protected $table = 'bingdi_admin';
    public function getAdminUserByUserName($username){
        if (empty($username)){
            return false;
        }
        $where=[
            'username'=>trim($username)
        ];
        $user=$this->where($where)->find();
        return $user;
    }
    public static function getById($id){
        $id=intval($id);
        return self::where('id',$id)
            ->find();
    }
    public function updateById($id,$data){
        $id=intval($id);
        if (empty($id)||empty($data)||!is_array($data)){
            return false;
        }
        $where=[
            'id'=>$id
        ];
        return $this->where($where)->save($data);
    }
}